import 'package:amway_superapp_creator_plugin/net/dio_log_interceptor.dart';
import 'package:amway_superapp_creator_plugin/net/http_manager.dart';
import 'package:amway_superapp_creator_plugin/net/token_interceptor.dart';
import 'package:amway_superapp_creator_plugin/routers/application.dart';
import 'package:amway_superapp_creator_plugin/routers/routes.dart';
import 'package:amway_superapp_creator_plugin/utils/dev_util.dart';
import 'package:amway_superapp_creator_plugin/utils/sp_util.dart';
import 'package:fluro/fluro.dart';
import 'package:flutter/material.dart';
import 'package:flutter_flavor/flutter_flavor.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
//import 'package:fluwx/fluwx.dart' as fluwx;


class CreateInitConfig {
  static CreateInitConfig _instance;

  CreateInitConfig._();

  factory CreateInitConfig() {
    _instance ??= CreateInitConfig._();
    return _instance;
  }

  static void initCofig({BuildContext context})async {
    ScreenUtil.init(context,designSize: Size(414, 896),allowFontScaling: false);
    await SpUtil.getInstance(); //等待Sp初始化完成
    await DevUtil.getInstance();
    final router = FluroRouter();
    Routes.configureRoutes(router);
    Application.router = router;
    var baseurl = FlavorConfig.instance.variables["baseUrl"];
    HttpManager()
        .init(baseUrl: baseurl, interceptors: [new TokenInterceptor(),DioLogInterceptor(),JWTTokenInterceptor()]);

 /*   var appId = FlavorConfig.instance.variables["appId"];
    var universalLink = FlavorConfig.instance.variables["universalLink"];

     fluwx.registerWxApi(
         appId: appId,
         doOnIOS: true,
         doOnAndroid: true,
         universalLink: universalLink);*/


  }

}
